﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsForms切换
{
    public partial class Form4 : Form
    {
        private Form1 parentForm;

        public Form4(Form1 form1)
        {
            InitializeComponent();
            this.parentForm = form1;

            // 隐藏父窗体
            this.FormClosed += Form4_FormClosed;
        }

        private void Form4_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (parentForm != null && !parentForm.Visible)
            {
                parentForm.Show();
                parentForm.Activate();
            }
        }
    }
}
